package cn.manager.travel.service.impl;

import cn.manager.travel.dao.AdminDao;
import cn.manager.travel.dao.impl.AdminDaoImpl;
import cn.manager.travel.domain.Admin;
import cn.manager.travel.domain.New;
import cn.manager.travel.service.AdminService;

import java.util.List;

public class AdminServiceImpl implements AdminService {
	AdminDao adminDao = new AdminDaoImpl();

	@Override
	public List<New> showNews() {
		List<New> news = null;
		try {
			news = adminDao.showNews();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return news;
	}
	
	@Override
	public Admin login(String username, String password) {
		return adminDao.login(username,password);
	}
	
	@Override
	public void add(String title, String author, String text) {
		adminDao.add(title,author,text);
	}
	
	@Override
	public void del(String nId) {
		adminDao.del(Integer.parseInt(nId));
		
	}
	
	@Override
	public void upd(String nID, String title, String author, String text) {
		adminDao.upd(Integer.parseInt(nID),title,author,text);
		
	}
}
